<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

JHtml::_('behavior.multiselect');

$user		= JFactory::getUser();
$userId		= $user->get('id');

$doc = JFactory::getDocument();
$doc->addStyleSheet("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/humanity/jquery-ui.css");
$doc->addStyleSheet(JURI::base()."media/system/css/system.css");
$doc->addStyleSheet(JURI::base()."administrator/templates/bluestork/css/template.css");
$doc->addStyleSheet(JURI::base()."components/com_mariageplanner/css/styles.css");

$doc->addScript("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js");
$doc->addScriptDeclaration('
		jQuery(document).ready(function() {
			jQuery("button").button();
		
		MP_RemoveTask = function(elm) {
			var $tr = jQuery(elm).closest("tr");
			var cb = $tr.find("[name^=cid]").attr("id");
			
			if(cb == "cbn")
				$tr.remove();
			else if(confirm("Вы уверены?")) 
				listItemTask(jQuery(elm).closest(\'tr\').find(\'input[name^=cid]\').attr(\'id\'),\'tasks.delete\');
		};
		
		MP_TaskDone = function(elm) {
			
		}
		
		MP_TaskSMS = function(elm) {
		}		
});
');
?>
<section class="ui-widget ui-widget-content ui-corner-all" style="padding: 10px;">
<?php if ($userId==0): ?>
<div id="alert_container" class="ui-widget">
	<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
        <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span></p>
        <p>
		<?php echo JText::sprintf( 'COM_MARIAGEPLANNER_TASKS_LOGIN_WARNING', JRoute::_('index.php?option=com_users&view=login'), JRoute::_('index.php?option=com_users&view=registration')); ?>
		</p>
    </div>
</div>
<?php endif ?>
<form action="<?php echo JRoute::_('index.php?option=com_mariageplanner&view=tasks'); ?>" method="post" name="adminForm" id="adminForm">
	<table class="adminlist">
		<thead>
			<tr>
				<th width="5%">
					<?php echo JText::_('COM_MARIAGEPLANNER_TASK_HEADING_DATE'); ?>
				</th>
				<th>
					<?php echo JText::_('COM_MARIAGEPLANNER_TASK_HEADING_MSG'); ?>
				</th>
				<th width="5%">
					<?php echo JText::_('COM_MARIAGEPLANNER_TASK_HEADING_STATE'); ?>
				</th>
				<th width="5%">
					<?php echo JText::_('COM_MARIAGEPLANNER_TASK_HEADING_SMSSTATE'); ?>
				</th>
				<th width="1%">
				</th>
			</tr>		
		</thead>
		<tfoot>
			<tr>
				<td colspan="5"><?php echo $this->pagination->getListFooter(); ?></td>
			</tr>
		</tfoot>
		<tbody>
	
<?php echo $this->loadTemplate('items'); ?>

		</tbody>
	</table>
	<div>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<?php echo JHtml::_('form.token'); ?>
	</div>

	<div class="toolbar">
		<a href="<?php echo JRoute::_('index.php?option=com_mariageplanner&view=task'); ?>"><button class="gradient" type="button">Добавить мероприятие</button></a>
	</div>
</form>

</section>